package cloud.xlh.test.config;

import com.xxl.job.core.context.XxlJobHelper;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * Created with IntelliJ IDEA.
 *
 * @ project name : xlh_osms
 * @ Author: XuLeHuang
 * @ Date: 2023/2/21 12:55
 * @ Description:
 */
@Component
@Slf4j
public class XxlJobWorkerConfig {

    /**
     * 1、简单任务示例（Bean模式）
     */
    @XxlJob("testJobHandler")
    public void demoJobHandler() throws Exception {
        System.out.println("XXL-JOB, Hello World.");
        XxlJobHelper.log("XXL-JOB, Hello World.");
        log.info("test模块执行xxl-job成功....");
       /* for (int i = 0; i < 5; i++) {
            XxlJobHelper.log("beat at:" + i);
            TimeUnit.SECONDS.sleep(2);
        }*/
        // default success
    }
}
